package com.aaa.controller;

import com.aaa.pojo.DefaultMsg;
import com.aaa.pojo.Order;
import com.aaa.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private OrderService orderService;

    @GetMapping("/findAllOrder")
    public List<Order> findAllOrder() {
        return orderService.findAllOrder();
    }

    @PostMapping("/updateStatusByOrderId")
    public DefaultMsg updateStatusByOrderId(Integer orderId, Integer status) {
        return orderService.updateStatusByOrderId(orderId, status);
    }
}
